#pragma once

#include <map>
#include <string>
#include "SDLRenderer.h"
#include "SDLInput.h"
#include "SDL.h"
#include "SDLTime.h"
#include "SDLScene.h"

class SDLEngine
{
#pragma region Singleton
public:
	static SDLEngine* GetInstance()
	{ 
		if(!instance)
		{
			instance = new SDLEngine();
		}
		return instance;
	}
	static void Kill()
	{
		delete instance;
		instance = 0;
	}
private:
	static SDLEngine* instance;
	SDLEngine();
	SDLEngine(const SDLEngine& e);
	~SDLEngine();
	SDLEngine& operator=(const SDLEngine& e);
#pragma endregion
public:
	void Start();

	bool SwitchToScene(std::string _scene);
	bool AddScene(std::string _sceneID, SDLScene* _scene);
	void Init();
	
	//Getters
	SDLScene* GetCurrentScene() const { return m_CurrentScene; }
	SDLScene* GetScene(std::string _scene) const;

private:
	SDLScene* m_CurrentScene;
	std::map<std::string, SDLScene*> m_Scenes;

	bool isInitialized;
	void Run();
	void Update();
	void Draw();
	void Stop();
};

